/**
 * author:汤圣军  
 * date:2013-08-14
 * 现金流量 模仿利润模型
 */
Cnbi.model.cash_flow = function(params){

   Cnbi.model.BaseSliderAndProgress.call(this,params); 
   
  /* defaults = this.defaults;
   var slider_array = defaults["slider_array"],
   progress_array = defaults["progress_array"], 
   scope=this,
   industryParams = defaults["industryParams"];*/
   var scope=this,
   datas = {};
   this.initPage = function(){	 
   	if(!scope.flag){
	      	CnbiSoft.setCurrentRenderer("JavaScript");
	  	}
	 scope.setSliderValue(slider_array,scope.datas,"input");
	 setFormula(false);
	 scope.setProgressValue(progress_array,scope.datas,"span");
	 scope.initSliderEvent(params.slider_array,scope.datas);
	 scope.flag=true;	   
    } 
   
/**
* 到数据库查询的方法
*/
this.updataInputAfter=function(id ,value,datas ){
   //setFormula(true); 
   if(id=="xssp"||id=="sdsf"||id=="sdqtss"||id=="gmsp"||id=="zfzg"||id=="zfjy"||id=="zfdgx"){
       		setJyhdFormula(true);
       		setXjjxFormula(true);
        }else if(id=="shtz"||id=="gjzc"||id=="qdtz"||id=="tzzf"||id=="czzc"||id=="zftz"||id=="sdqtytz"){
            setTzhdFormula(true);
            setXjjxFormula(true);
        }else if(id=="xstz"||id=="chzw"||id=="qdjk"||id=="fpgl"||id=="sdcz"||id=="zfcz"){
            setCzhdFormula(true);
            setXjjxFormula(true);
        }
   };
   
/**
* 设置所有公式值
*/
function setFormula(action){
   setJyhdFormula(action);
   setTzhdFormula(action);
   setCzhdFormula(action);
   setXjjxFormula(action);
   }

/**
* 经营活动产生的现金流量净额=销售商品、提供劳务收到的现金,,,,,,
*/
function setJyhdFormula(action){
   var jyhdValue = (scope.datas.xssp+scope.datas.sdsf+scope.datas.sdqtss-(scope.datas.gmsp+scope.datas.zfzg+scope.datas.zfjy+scope.datas.zfdgx));
   scope.datas["jyhd"] = Utils.formatFloat(jyhdValue,2);   
   if(action) scope.updataSpanAndProgess("jyhd_span");
   //if(action) scope.updataSpanAndProgess("xjjx_span");
   }   
   
function setTzhdFormula(action){
   var tzhdValue = (scope.datas.shtz+scope.datas.qdtz+scope.datas.czzc+scope.datas.sdqtytz-(scope.datas.gjzc+scope.datas.tzzf+scope.datas.zftz));
   scope.datas["tzhd"] = Utils.formatFloat(tzhdValue,2);   
   if(action) scope.updataSpanAndProgess("tzhd_span");
   //if(action) scope.updataSpanAndProgess("xjjx_span");
   } 

function setCzhdFormula(action){
   var czhdValue = (scope.datas.xstz+scope.datas.qdjk+scope.datas.sdcz-(scope.datas.chzw+scope.datas.fpgl+scope.datas.zfcz));
   scope.datas["czhd"] = Utils.formatFloat(czhdValue,2);   
   if(action) scope.updataSpanAndProgess("czhd_span");
   //if(action) scope.updataSpanAndProgess("xjjx_span");
   }
   
function setXjjxFormula(action){
   var jyhdValue = (scope.datas.xssp+scope.datas.sdsf+scope.datas.sdqtss-(scope.datas.gmsp+scope.datas.zfzg+scope.datas.zfjy+scope.datas.zfdgx));
   var tzhdValue = (scope.datas.shtz+scope.datas.qdtz+scope.datas.czzc+scope.datas.sdqtytz-(scope.datas.gjzc+scope.datas.tzzf+scope.datas.zftz));
   var czhdValue = (scope.datas.xstz+scope.datas.qdjk+scope.datas.sdcz-(scope.datas.chzw+scope.datas.fpgl+scope.datas.zfcz));
   
   var value = jyhdValue+tzhdValue+czhdValue;
   
   scope.datas["xjjx"] = Utils.formatFloat(value,2);   
   if(action) scope.updataSpanAndProgess("xjjx_span");
   }
   scope.init();
  /* setTimeout(function() {//fadeOut  //sildeIn
   Ext.get("loading").remove();
   Ext.get("loading-mask").fadeOut({remove : true});		
  }, 2000);*/
}

  